n = int(input())
nums = list(map(int,input().split()))
nums.sort()

length = len(nums)

result = nums[int(length / 2)]

less = 0
large = 0

i = int(length / 2)
while i >= 0:
    if nums[i] < result:
        break
    i-=1
i+=1
less=i

i = int(length / 2)
while i<n:
    if nums[i]>result:
        break
    i+=1
i-=1
large=n-i-1

if less!=large:
    print(-1)
else:
    print(result)




    
